<?php

namespace app\mall\ui\form;

use app\mall\enum\YesNoEnum;

/**
 * 分类表单
 */
class MallCateForm
{
    public function parent_id()
    {
        return [
            'type' => 'number',
            'title' => '父类id',
            'field' => 'parent_id',
        ];
    }

    public function title()
    {
        return [
            'type' => 'input',
            'title' => '分类名称',
            'field' => 'title',
            'validate' => [
                ['required' => true, 'message' => '不能为空']
            ]
        ];
    }

    public function icon()
    {
        return [
            'type' => 'uploadImage',
            'action' => config('thinkAdmin.upload_url'),
            'title' => '图标url',
            'field' => 'icon',
        ];
    }

    public function inx()
    {
        return [
            'type' => 'number',
            'title' => '排序',
            'field' => 'inx',
            'value' => 100,
        ];
    }

    public function is_menu()
    {
        return [
            'type' => 'radio',
            'options' => YesNoEnum::toZhArrayForSelect(),
            'title' => '是否为菜单',
            'field' => 'is_menu',
            'value' => 1,
        ];
    }
}